package com.Helper;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.*;

import com.database.FlightDB;
import com.database.ReservationDB;
import com.database.SeatDB;

public class SeatHelper 
{
	private static Connection connection = null;
	
	
	public static void Setup(Connection _connection) throws SQLException
	{
		connection = _connection;
	}
	
	public static SeatInfo GetSelectedSeat(String seat, String flight) throws SQLException
	{
		SeatDB db = new SeatDB();
		db.Setup(connection);
		SeatInfo info = db.GetSelectedSeat(seat, flight);
		return info;
	}
	
	public static boolean IsSeatReserved(String seat, String flight) throws SQLException
	{
		SeatDB db = new SeatDB();
		db.Setup(connection);
		
		if (db.IsReserved(seat, flight))
		{
			return true;
		}
		else
		{
			return false;
		}
	}
	
	public static ArrayList<SeatInfo> GetReservedSeat(String flightID) throws SQLException
	{
		SeatDB db = new SeatDB();
		db.Setup(connection);
		ArrayList<SeatInfo> list = db.GetReservedSeat(flightID);
		return list;
	}
	
	public static void MarkEmpty(String seat, String flight) throws SQLException
	{
		SeatDB db = new SeatDB();
		db.Setup(connection);
		db.MarkEmpty(seat, flight);
	}
	
	public static void MarkReserved(String seat, String flight) throws SQLException
	{
		SeatDB db = new SeatDB();
		db.Setup(connection);
		db.MarkReserved(seat, flight);
	}
	
	
	
}
